/* eslint-disable react/jsx-pascal-case */
import React, { useState ,useEffect}  from 'react'

import { Input } from 'react-vant';
import My_content from "../components/My_content"
import {useSelector,useDispatch} from "react-redux"
import {search_value,get_list} from "../api/index"
import {RootState,RootDispatch} from "../utils/index"
import _ from "lodash"
type Props = {}

const Search = (props: Props) => {  

    const dispatch :RootDispatch = useDispatch()
    const [value, setValue] = useState('');
    const {children_data} = useSelector((state:RootState)=>state)
    useEffect(()=>{
        dispatch(get_list())
    },[dispatch])

    const set_value =(e:string) =>{
        setValue(e)
        dispatch(search_value(e))
    }
  return (
    <div className='search'>
         <Input
          value={value}
          style={{height:"50px"}}
          onChange={(text) =>set_value(text) }
          placeholder='请输入文本'
        />
        <My_content data_content={children_data}/>
    </div>
  )
}

export default Search